package edu.cmu.vlis.datamining.core;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class Vertex implements Serializable {
    
    Integer vertexId;
    String vertexUrl;
    String supplementaryUrl;
    Date datePosted;
    String authorName;
    String blogPostTitle;
    String webLogTitle;
    String type;
    
    Map<Vertex,List<Feature>> features;
    
    public Vertex(Integer uniqid,String url) {
        this.vertexId = uniqid;
        this.vertexUrl = url;
        this.features = new HashMap<Vertex, List<Feature>>();          
    }
   
    
    public Integer getVertexId() {
        return this.vertexId;
    }
    
    public String getSupplementaryUrl() {
        return this.supplementaryUrl;
    }
    
    public String getVertexUrl() {
        return this.vertexUrl;
    }
    
    public String getBlogPostTitle() {
        return this.blogPostTitle;
    }
    
    public  String getWebLogTitle() {
        return this.webLogTitle;
    }
    public String getAuthorName() {
        return this.authorName;
    }
    
    public Date getDatePosted() {
        return this.datePosted;
    }
    
    public  void setBlogPostTitle(String blogPostTitle) {
        this.blogPostTitle = blogPostTitle;
    }
    
    public  void setWebLogTitle(String webLogTitle) {
        this.webLogTitle = webLogTitle;
    }
    public void  setAuthorName(String authorName) {
        this.authorName = authorName;
    }
    
    public void setDatePosted(Date datePosted) {
        this.datePosted = datePosted;
    }
    
    public void setType(String type) {
        this.type = type;
    }
    
    public void setSupplementaryUrl(String site) {
        this.supplementaryUrl= site;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result
                + ((authorName == null) ? 0 : authorName.hashCode());
        result = prime * result
                + ((blogPostTitle == null) ? 0 : blogPostTitle.hashCode());
        result = prime * result + ((vertexUrl == null) ? 0 : vertexUrl.hashCode());
        result = prime * result
                + ((datePosted == null) ? 0 : datePosted.hashCode());
        result = prime * result + ((supplementaryUrl == null) ? 0 : supplementaryUrl.hashCode());
        result = prime * result + ((type == null) ? 0 : type.hashCode());
        result = prime * result
                + ((vertexId == null) ? 0 : vertexId.hashCode());
        result = prime * result
                + ((webLogTitle == null) ? 0 : webLogTitle.hashCode());
        return result;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {

        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (!(obj instanceof Vertex))
            return false;
        Vertex other = (Vertex) obj;
        if (vertexId == null) {
            if (other.vertexId != null)
                return false;
        } else if (!vertexId.equals(other.vertexId))
            return false;
        return true;
    }

    /**
     * @return the features
     */
    public Map<Vertex, List<Feature>> getFeatures() {
        return features;
    }

    /**
     * @param features the features to set
     */
    public void setFeatures(Vertex neighbor, List<Feature> features) {
        this.features.put(neighbor,features);
    }
    
    public void setFeature(Vertex neighbor, Feature f){
        
    }

}
